package com.zm.Study03_FileInAndOutputTest;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * 刚学完字节流读取，每次都一个，接下来一读读一个数组
 */
public class TxtReadAndWrite {
    public static void main(String[] args) throws IOException {
        String readPath="D:\\project\\IDEAPROJECT\\JavaIO\\src\\main\\resources\\static\\test\\读取目标文件.txt";
        String writePath="D:\\project\\IDEAPROJECT\\JavaIO\\src\\main\\resources\\static\\test\\写入目标文件.txt";
        //先读取
        FileInputStream fis=new FileInputStream(readPath);
        //写入
        FileOutputStream fos=new FileOutputStream(writePath,true);
        StringBuilder stringBuilder = null;
        int by;
        while ((by=fis.read())!=-1){
           fos.write(by);
        }

        fis.close();
        fos.close();
    }
}
